<template>
  <h2>vuex的改写</h2>
  <p>num: {{ num }}</p>
  <button @click="fn">btn</button>
</template>

<script setup>
// 用了组合式api以后，就不能再使用辅助函数了

// this.$store.state.xxx

import { useStore } from "vuex";
import { computed } from "vue";

const store = useStore();

const num = computed(() => {
  return store.state.num;
});

const fn = () => {
  store.commit("changeNum");
};
</script>
